<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var f = function (args) {
        return args.m + args.n;
      };
      console.log(`f({m: 1, n: 2}) === 3 => ${f({ m: 1, n: 2 }) === 3}`);
      var g = function (f, cb) {
        // 实现函数g, 满足后续代码
      };
      var f1 = g(f, function (args, next) {
        return next();
      });
      console.log(`f1({m: 1, n: 2}) === 3 => ${f1({ m: 1, n: 2 }) === 3}`);
      var f2 = g(f, function (args, next) {
        return next() + 1;
      });
      console.log(`f2({m: 1, n: 2}) === 4 => ${f2({ m: 1, n: 2 }) === 4}`);
      var f3 = g(f2, function (args, next) {
        return next() + 1;
      });
      console.log(`f3({m: 1, n: 2}) === 5 => ${f3({ m: 1, n: 2 }) === 5}`);
    </script>
  </body>
</html>
